import request from "@/utils/request";

// 查询问题列表
export function list(query) {
  return request({
    url: "approve/workOrder/list",
    method: "get",
    params: query
  });
}

// 查询门户问题列表
export function portalList(query) {
  return request({
    url: "approve/workOrder/portalList",
    method: "get",
    params: query,
    headers: {
      showLoading: false
    }
  });
}

// 查询问题详情
export function findById(id) {
  return request({
    url: `approve/workOrder/queryById/${id}`,
    method: "get"
  });
}

// 删除问题
export function delConfig(id) {
  return request({
    url: `approve/workOrder/deleteById/${id}`,
    method: "post"
  });
}

// 新增问题
export function save(data) {
  return request({
    url: "approve//workOrder/addWorkOrder",
    method: "post",
    data
  });
}

// 确认完成
export function complete(id) {
  return request({
    url: `approve/workOrder/complete/${id}`,
    method: "post"
  });
}

// 获取最新回复
export function checkCurrentReply(params) {
  return request({
    url: "approve/workOrder/checkCurrentReply",
    method: "get",
    params
  });
}

// 回复
export function reply(data) {
  return request({
    url: "approve/workOrder/reply",
    method: "post",
    data
  });
}

// 审批
export function audit(type, id) {
  return request({
    url: `approve/workOrder/audit/${type}/${id}`,
    method: "post"
  });
}

// 所属应用下拉来源
export function applicationAllList() {
  return request({
    url: "system/app/orderedListAll",
    method: "get"
  });
}